{extend name="public/base" /}

<!-- 关掉头部 -->
{block name="header"}{/block}
<!-- 关掉菜单 -->
{block name="menu"}{/block}

{block name="content"}
<article class="cl pd-20">
    <form action="" method="post" class="form form-horizontal" id="form-admin-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="姓名" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">性别：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:150px;">
                    <select class="select" name="sex" size="1">
                        <option value="1" >男</option>
                        <option value="0" >女</option>
                    </select>
                </span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">年龄：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="" placeholder="年龄" id="age" name="age">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">手机号码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="手机号码" name="mobile" id="mobile" value="">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">邮箱：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="邮箱" name="email" id="email" value="">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">入学时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="入学时间" name="start_time" id="start_time" value="">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">班级：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:200px;">
                    <select class="select" name="grade_id" size="1">
                        {volist name='gradeList' id='vo'}
                            <option value="{$vo.id}">{$vo.name}</option>
                        {/volist}
                    </select>
                </span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">启用状态：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:150px;">
                    <select class="select" name="status" size="1">
                        <option value="1">启用</option>
                        <option value="0" >不启用</option>
                    </select>
                </span>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input id="submit" class="btn btn-primary radius disabled" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}

{block name="js"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
    $('form').children().change(function(){
        $('#submit').removeClass('disabled');
    })

    $('#submit').on('click',function(event){
        $.ajax({
            type:'POST',
            url:'{:url("student/doAdd")}',
            data:$('#form-admin-add').serialize(),
            dataType:'json',
            success:function(data){
                if(data.status==1){
                    parent.location.reload();
                }else{
                    alert(data.message);
                }
            }
        })
    })
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}